Fixes for #12804 and #134722, Damon Chaplin:
authorMatthias Clasen <maclas@gmx.de>
Thu, 26 Feb 2004 20:51:02 +0000 (20:51 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 26 Feb 2004 20:51:02 +0000 (20:51 +0000)
Thu Feb 26 21:52:58 2004  Matthias Clasen  <maclas@gmx.de>

Fixes for #12804 and #134722, Damon Chaplin:

* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end):
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start):
Ref and sink the cell renderers here.

* gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell
renderers here, and free attributes and func_data.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcombobox.c

index 2de2b3e658c9a3ee02e603eb47a2f5feec3330be..d2017a6d845cd21d97d20529dc00307729733b9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Feb 26 21:52:58 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fixes for #12804 and #134722, Damon Chaplin:
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): 
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): 
+       Ref and sink the cell renderers here.
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell
+       renderers here, and free attributes and func_data. 
+
 Thu Feb 26 21:41:38 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition.
index 2de2b3e658c9a3ee02e603eb47a2f5feec3330be..d2017a6d845cd21d97d20529dc00307729733b9c 100644 (file)
@@ -1,3 +1,14 @@
+Thu Feb 26 21:52:58 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fixes for #12804 and #134722, Damon Chaplin:
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): 
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): 
+       Ref and sink the cell renderers here.
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell
+       renderers here, and free attributes and func_data. 
+
 Thu Feb 26 21:41:38 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition.
index 2de2b3e658c9a3ee02e603eb47a2f5feec3330be..d2017a6d845cd21d97d20529dc00307729733b9c 100644 (file)
@@ -1,3 +1,14 @@
+Thu Feb 26 21:52:58 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fixes for #12804 and #134722, Damon Chaplin:
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): 
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): 
+       Ref and sink the cell renderers here.
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell
+       renderers here, and free attributes and func_data. 
+
 Thu Feb 26 21:41:38 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition.
index 2de2b3e658c9a3ee02e603eb47a2f5feec3330be..d2017a6d845cd21d97d20529dc00307729733b9c 100644 (file)
@@ -1,3 +1,14 @@
+Thu Feb 26 21:52:58 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fixes for #12804 and #134722, Damon Chaplin:
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): 
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): 
+       Ref and sink the cell renderers here.
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell
+       renderers here, and free attributes and func_data. 
+
 Thu Feb 26 21:41:38 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition.
index 2de2b3e658c9a3ee02e603eb47a2f5feec3330be..d2017a6d845cd21d97d20529dc00307729733b9c 100644 (file)
@@ -1,3 +1,14 @@
+Thu Feb 26 21:52:58 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fixes for #12804 and #134722, Damon Chaplin:
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): 
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): 
+       Ref and sink the cell renderers here.
+       
+       * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell
+       renderers here, and free attributes and func_data. 
+
 Thu Feb 26 21:41:38 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition.
index 357e5f6954ee217f7dd7c28ce62eb09ea56d4785..1ae57c59b75d911fc752e18225975b3769ede9da 100644 (file)
@@ -2138,6 +2138,9 @@ gtk_combo_box_cell_layout_pack_start (GtkCellLayout   *layout,
 
   combo_box = GTK_COMBO_BOX (layout);
 
+  g_object_ref (G_OBJECT (cell));
+  gtk_object_sink (GTK_OBJECT (cell));
+
   info = g_new0 (ComboCellInfo, 1);
   info->cell = cell;
   info->expand = expand;
@@ -2187,6 +2190,9 @@ gtk_combo_box_cell_layout_pack_end (GtkCellLayout   *layout,
 
   combo_box = GTK_COMBO_BOX (layout);
 
+  g_object_ref (G_OBJECT (cell));
+  gtk_object_sink (GTK_OBJECT (cell));
+
   info = g_new0 (ComboCellInfo, 1);
   info->cell = cell;
   info->expand = expand;
@@ -3005,6 +3011,7 @@ static void
 gtk_combo_box_finalize (GObject *object)
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (object);
+  GSList *i;
   
   gtk_combo_box_unset_model (combo_box);
 
@@ -3020,7 +3027,24 @@ gtk_combo_box_finalize (GObject *object)
   if (combo_box->priv->model)
     g_object_unref (combo_box->priv->model);
 
-   g_slist_foreach (combo_box->priv->cells, (GFunc)g_free, NULL);
+  for (i = combo_box->priv->cells; i; i = i->next)
+    {
+      ComboCellInfo *info = (ComboCellInfo *)i->data;
+      GSList *list = info->attributes;
+
+      if (info->destroy)
+       info->destroy (info->func_data);
+
+      while (list && list->next)
+       {
+         g_free (list->data);
+         list = list->next->next;
+       }
+      g_slist_free (info->attributes);
+
+      g_object_unref (G_OBJECT (info->cell));
+      g_free (info);
+    }
    g_slist_free (combo_box->priv->cells);
 
    G_OBJECT_CLASS (parent_class)->finalize (object);